<%-- 
    Document   : processtron
    Created on : May 2, 2014, 2:24:04 PM
    Author     : bmbolen2017
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="edu.manchester.biology.eqhei.interfaces.*" %>
<%@page import="edu.manchester.biology.eqhei.implementations.*" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Processtron</title>
        <%
            //Fill out evaluation
            eQHEI_Evaluation eval = (eQHEI_Evaluation) session.getAttribute("Eval");
            eQHEI_Header head = (eQHEI_Header) session.getAttribute("Header");
            for(int i = 0; i<eval.length(); i++)
            {   //i is for Sections
                eQHEI_Section s = eval.get(i);
                for(int j=0; j<s.length(); j++)
                {   //j is for Attribute Sets
                    eQHEI_AttributeSet at = s.get(j);
                    for(int k=0; k<at.length(); k++)
                    {   //k is for Attribute
                        eQHEI_Attribute a = at.get(k);
                        Integer count = Integer.parseInt(request.getParameter(a.getName()+"_"+at.getName()));
                        while(count>0)
                        {
                            a.increment();
                            count--;
                        }

                    }
                }
            }
            
            //Send to middle man (then to database)
            session.setAttribute("Eval",eval);
            
            //Fill out header
            head.setDate(request.getParameter("date"));
            head.setUsername(request.getParameter("username"));
            head.setUTM(new eQHEI_UTMIMP(request.getParameter("UTM")));
            head.setStreamReach(new eQHEI_StreamReachIMP(new eQHEI_UTMIMP(request.getParameter("UTM")), request.getParameter("stream")));
            //Send to middle man (then to database)
            session.setAttribute("Header",head);
         %>
    </head>
    <body>
        <h1>Thinkin' real hard!</h1>
    </body>
</html>
